package test;

import java.util.Random;

import cn.edu.zjut.chopper.exception.AlreadyBoundException;
import cn.edu.zjut.chopper.message.RemoteInterface;
import cn.edu.zjut.chopper.name.handler.NameServerHandler;


public class aaa {

	/**
	 * @param args
	 */
	public static void main(String[] args) {
		
		
		try {
			NameServerHandler.bind("echoService", new RemoteInterface("echoService", "1.0", "http://127.0.0.1:8080/chopper/hello","file path","note"));
			NameServerHandler.bind("echoService", new RemoteInterface("echoService", "2.0", "http://127.0.0.1:8080/chopper/hello","file path","note"));
			NameServerHandler.bind("helloService", new RemoteInterface("helloService", "2.0", "http://127.0.0.1:8080/chopper/hello","file path","note"));
			NameServerHandler.bind("helloService", new RemoteInterface("helloService", "1.0", "http://127.0.0.1:8080/chopper/hello","file path","note"));
			NameServerHandler.bind("printService", new RemoteInterface("printService", "1.0", "http://127.0.0.1:8080/chopper/hello","file path","note"));
			NameServerHandler.bind("printService", new RemoteInterface("printService", "2.0", "http://127.0.0.1:8080/chopper/hello","file path","note"));
			NameServerHandler.bind("loginService", new RemoteInterface("loginService", "1.0", "http://127.0.0.1:8080/chopper/hello","file path","note"));
			NameServerHandler.bind("loginService", new RemoteInterface("loginService", "2.0", "http://127.0.0.1:8080/chopper/hello","file path","note"));
			NameServerHandler.bind("loginService", new RemoteInterface("loginService", "3.0", "http://127.0.0.1:8080/chopper/hello","file path","note"));
			NameServerHandler.bind("caculateService", new RemoteInterface("caculateService", "1.0", "http://127.0.0.1:8080/chopper/hello","file path","note"));
			NameServerHandler.bind("caculateService", new RemoteInterface("caculateService", "2.0", "http://127.0.0.1:8080/chopper/hello","file path","note"));
			NameServerHandler.bind("caculateService", new RemoteInterface("caculateService", "3.0", "http://127.0.0.1:8080/chopper/hello","file path","note"));

			for(int i=0;i<20;i++){
				NameServerHandler.bind("fk"+i, new RemoteInterface("fk"+i, i+".0", "http://"+new Random().nextInt(255)+"."+new Random().nextInt(255)+"."+new Random().nextInt(255)+"."+new Random().nextInt(255)+":"+new Random().nextInt(65535)+"/chopper/hello","file path","note"));
			}
			
			/*for(int i=0;i<10000;i++){
				NameServerHandler.bind("xh", new RemoteInterface("xh", "1.0"+i, "http://192.168.1.26:8080/chopper/hello","file path","note"));
			}*/
		} catch (AlreadyBoundException e) {
			// TODO Auto-generated catch block
			e.printStackTrace();
		}
		
	    

	}

}
